<template>
  <div>
    <el-dialog :title="title" class width="1000px" :visible.sync="dialogPdfVisible">
      <iframe :src="previewSrc" height="600" width="100%" />
      <!-- <div
        v-else
        style="height: 600px; overflow: auto;">
        <el-image
          :src="previewUrl"
          style="width: 100%;" />
      </div> -->
    </el-dialog>
  </div>
</template>

<script>
import { previewUrl, previewUrlInfo } from '../../const/common';
export default {
  data() {
    return {
      dialogPdfVisible: false,
      title: '',
      isPrint: false,
      previewUrl: ''
    };
  },
  computed: {
    // isPdf () {
    //   return /\.pdf$/.test(this.previewUrl)
    // },
    // previewSrc () {
    //   // 'https://md.heng-tai.com.cn/guoke-deepexi-utils-server-h5/pdf/web/viewer.html?file=
    //   // 默认是开发环境的地址
    //   return (
    //     (process.env.NODE_ENV === 'development' ? 'https://md.heng-tai.com.cn' : window.location.origin) +
    //     '/guoke-deepexi-utils-server-h5/pdf/web/viewer.html?file=' + this.previewUrl
    //   )
    // },
    previewSrc() {
      return this.isPrint ? String(previewUrlInfo) + this.previewUrl : String(previewUrl) + this.previewUrl;
    }
  }
};
</script>
